package com.kfm.jdbc.day0327;

import com.kfm.jdbc.day0327.entity.Account;

import java.sql.ResultSet;
import java.sql.SQLException;

public class DBUtilsDemo {

    public static void main(String[] args) throws SQLException {
        String url = "jdbc:mysql://localhost:3306/kfm_store";
        String username = "root";
        String password = "";
        DBUtils<Account> dbUtils = new DBUtils(url, username, password);

        String sql = "select * from account where id = 1";

        ResultSet resultSet = dbUtils.select(sql);



        Account account = new Account();
        while (resultSet.next()){
            account.setId(resultSet.getInt("id"));
            account.setPhone(resultSet.getString("phone"));
        }

        dbUtils.close();
    }
}
